RewriteEngine On

##Y esto http a httpS
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
Header always set Content-Security-Policy "upgrade-insecure-requests;"

##Que no requieras .html o .php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteRule ^([^\.]+)$ $1.html [NC,L]

##Con esto haces que el sitemap que se genera con php se vea como si fuera xml, al final el echo es xml valido
##RewriteEngine On   ##Ya hay uno no requieres otro
RewriteRule ^sitemap.xml$ xmlsitemap.php [L] ##Esto en realidad hace un 404 pero ahí haces el echo de sitemap.php
RewriteRule ^rss.xml$ xmlrss.php [L] ##Esto en realidad hace un 404 aunque deberia bastar por si solo, pero YOLO el servidor
##RewriteRule ^sitemap$ sitemap.php [L] ##esto no sirve

##Con esto defines la ruta a tu archivo 404, si vas a crear paginas dinamicas en vez de un echo 404 con ciertos uris haces echo del template y contenido pertinente
ErrorDocument 404 /404.php